package mbcontrol;

import java.sql.Connection;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;
import model.ConnectDb;
import dao.BancosJDBCCadastro;
import dao.PersistConexao;

public class MBSelectBancos {
	private ConnectDb connectdb = new ConnectDb();
	String schema = connectdb.getSchema_producao();
	String user = connectdb.getUser();
	String pass = connectdb.getPass();

	private String nmbancos;
	private Map<String, String> sbancos = new HashMap<String, String>();
	ResultSet result = null;
	public static String snmbanco;
	public static String scdbanco;

	public MBSelectBancos() {
		PersistConexao persistconexao = new PersistConexao();
		Connection conexao = persistconexao.openConecao(schema, user, pass);

		sbancos = new HashMap<String, String>();
		BancosJDBCCadastro daoinst = new BancosJDBCCadastro(conexao);
		result = daoinst.ResultBancos();
		try {
			result.first();
			while (!result.isAfterLast()) {
				sbancos.put(result.getString("NMINSTCOBRANCA"),
						result.getString("CDINSTCOBRANCA"));
				System.out.println("CODIGO BANCO " + scdbanco);
				result.next();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

	public String getNmbancos() {
		return nmbancos;
	}

	public void setNmbancos(String nmbancos) {
		this.nmbancos = nmbancos;
	}
}
